/**
 * 
 */
package cn.java.innerclass;


/**
* 视频处理类
* @author 攀博课堂
* @version v1.0
*/
public class VideoProcessor2 extends Processor{
	
	//视频
	private Video video;
	
	public VideoProcessor2(Video video) {
		this.video = video;
	}
	//处理结果
	private VideoProcessorResult videoProcessorResult;
	
	//外部类成员方法
	public void printVideo() {
		System.out.println(video);
	}
	
	//处理方法
	public void process() {
		//创建一个任务对象
		VideoProcessorTask videoProcessorTask = new VideoProcessorTask();
		//启动任务进行处理
		videoProcessorTask.start();
	}
	
	//视频处理任务内部类
	private class VideoProcessorTask{
		
		//启动任务
		public void start() {
			System.out.println("启动视频处理任务");
			//拥有外部类对象的引用
			System.out.println(VideoProcessor2.this);
			//输出视频信息
			printVideo();
			//也可以改为如下方式使用外部类成员方法
			VideoProcessor2.this.printVideo();
			//开始处理...
			//拿到处理结果
			videoProcessorResult = new VideoProcessorResult(1,"成功","http://www.pbteach.com/1");
			
			
		}
		
	    //终止任务
		public void cancel() {
			System.out.println("终止任务");
		}
		
	}
	
	//处理结果内部类
	public class VideoProcessorResult extends ProcessorResult{
		

		//视频新地址
		private String newAddress;
		
		public VideoProcessorResult(int code,String msg,String newAddress) {
			super(code, msg);
			this.newAddress = newAddress;
		}

		@Override
		public String toString() {
			return "VideoProcessorResult [code=" + getCode() + ", msg=" + getMsg() + ", newAddress=" + newAddress + "]";
		}
		
		
		
	}
	
	//获取处理结果
	public VideoProcessorResult getVideoProcessorResult() {
		return videoProcessorResult;
	}


}
